1. Field of the Invention
The present invention relates generally to an improved data processing system and in particular to a method and apparatus for executing instructions. Still more particularly, the present invention relates to a computer implemented method, apparatus, and computer usable program code for tracing processes during the execution of instructions.
2. Description of the Related Art
Debugging software is a methodical process for finding and reducing the number of bugs. Bugs are errors, flaws, mistakes, failures, or faults in computer software that prevent the software from behaving or executing as intended. Most bugs arise from mistakes and errors made by programmers either in the source code or design of the program. Some bugs are caused by compilers producing the incorrect code. Process tracing is one mechanism used for debugging software. With process tracing, one process attaches to another process. Operating systems, such as AIX® in UNIX®, support process tracing as a mechanism to monitor and control the execution of the process.
With debugging software, breakpoints are set in the traced processes. Breakpoints are instructions that are inserted into the executable instructions in the code of a traced process that allow the tracing process to be notified when the traced process has reached the point of execution identified by the breakpoint. These breakpoints are also referred to as breakpoint traps. When the traced process encounters a breakpoint, the traced process stops execution and notifies another program or software component. Typically, this notified software component is referred to as a handler or debugger. This debugger then analyzes data related to the execution of the process that has occurred. The debugger may generate results and notifications based on the analysis.
The instructions in the code where breakpoints are inserted are shared by all threads for a process. As a result, any breakpoint that is set for the process is visible to all of the threads of the process. This situation means that if any thread in the process hits the breakpoint, the entire process is stopped and the debugger is notified. In a multi-threaded process, it is common to only want to trace a subset of the threads that are present for the process.
Currently, this type of conditional breakpoint involves the debugger evaluating whether the thread that hit the breakpoint is the thread of interest when the process stops on the breakpoint. If the thread is not a thread of interest, the debugger replaces the breakpoint trap with the original instruction, single steps the thread to that instruction to execute the instruction, restores the breakpoint after the thread has executed the original instruction, and then allows the process to continue execution.